package cn.iocoder.yudao.module.yyzx.dal.mysql.customer;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.yyzx.dal.dataobject.customer.CustomerDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.yyzx.controller.admin.customer.vo.*;

/**
 * 客户信息 Mapper
 *
 * @author jzh
 */
@Mapper
public interface CustomerMapper extends BaseMapperX<CustomerDO> {

    default PageResult<CustomerDO> selectPage(CustomerPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<CustomerDO>()
                .likeIfPresent(CustomerDO::getCustomerName, reqVO.getCustomerName())
                .eqIfPresent(CustomerDO::getCustomerAge, reqVO.getCustomerAge())
                .eqIfPresent(CustomerDO::getCustomerSex, reqVO.getCustomerSex())
                .eqIfPresent(CustomerDO::getIdcard, reqVO.getIdcard())
                .eqIfPresent(CustomerDO::getRoomNumber, reqVO.getRoomNumber())
                .eqIfPresent(CustomerDO::getBuildingId, reqVO.getBuildingId())
                .eqIfPresent(CustomerDO::getRecordId, reqVO.getRecordId())
                .eqIfPresent(CustomerDO::getElderType, reqVO.getElderType())
                .betweenIfPresent(CustomerDO::getCheckinDate, reqVO.getCheckinDate())
                .betweenIfPresent(CustomerDO::getExpirationDate, reqVO.getExpirationDate())
                .eqIfPresent(CustomerDO::getContactTel, reqVO.getContactTel())
                .eqIfPresent(CustomerDO::getBedId, reqVO.getBedId())
                .eqIfPresent(CustomerDO::getPsychosomaticState, reqVO.getPsychosomaticState())
                .eqIfPresent(CustomerDO::getAttention, reqVO.getAttention())
                .eqIfPresent(CustomerDO::getBirthday, reqVO.getBirthday())
                .eqIfPresent(CustomerDO::getHeight, reqVO.getHeight())
                .eqIfPresent(CustomerDO::getMaritalStatus, reqVO.getMaritalStatus())
                .eqIfPresent(CustomerDO::getWeight, reqVO.getWeight())
                .eqIfPresent(CustomerDO::getBloodType, reqVO.getBloodType())
                .eqIfPresent(CustomerDO::getFilepath, reqVO.getFilepath())
                .betweenIfPresent(CustomerDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(CustomerDO::getId));
    }

}